
//拿 mongoose 驱动
const mongoose = require("mongoose")

// 创建数据结构 productsSchema
let commodityModel = new mongoose.Schema({
    name: String,
    desc: String,
    guarantee: String,
    aftersale: String,
    storeCondition: String,
    place: String,
    specs: String,
    pack: String,
    sales: String,
    image: [String],        // 商品图片
    detailsImage: [String], //商品详情图片
    Child_type: { type: "ObjectId", ref: "childType" },
    // 价格
})

// 根据数据结构 productsSchema 在数据库中创建 products 集合
mongoose.model("commodity", commodityModel, "commodity");